<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- js没有函数重载的概念，重复声明下面的会覆盖 ps:重载：根据传入参数的不同，动态决定调用哪个方法-->
    <script>
        function go(a){
            console.log(a);
        }
        function go(a,b){
            console.log(a,b);
        }
        go(10);
        go(10,20)
    </script>


    <!-- 使用arguments模拟重载 -->
    <script>
        function go2(){
            if (arguments.length == 1){
                console.log(arguments[0])
            }else if(arguments.length == 2){
                console.log(arguments[0]+arguments[1])
            }
        }
        go2(10);
        go2(10,20)
    </script>
</body>
</html>